{include /common/header}
<script>
	var M = {};
	$(function() {
		M.selectType = function(value){
			if (value == 'select' || value == 'checkbox') {
				$('._hidden').show(100);
			}else{
				$('._hidden').hide(100);
			}
		}
	});
</script>
<style>
	._hidden{
		display: none;
	}
</style>
<div class="title">字段管理</div>
<form action="{:\mylib\Route::buildUrl('/admin/field/add')}" method="POST">
    <fieldset>
        <legend>新增字段</legend>

        <div class="form-group">
            <label>分组</label>
            <input type="text" class="form-control" name="group" value="" required>
        </div>

        <div class="form-group">
            <label>标题</label>
            <input type="text" class="form-control" name="title" value="" required>
            <span class="help-block">表单的标题</span>
        </div>

        <div class="form-group">
            <label>字段名称</label>
            <input type="text" class="form-control" name="field" value="" required>
            <span class="help-block">英文字符</span>
        </div>

        <div class="form-group">
            <label>字段类型</label>
            <select class="form-control" name="type" required onchange="M.selectType(this.value)">
                <option value="text" selected>单行文本</option>
                <option value="textarea">多行文本</option>
                <option value="select">单项选择</option>
                <option value="checkbox">多项选择</option>
                <option value="editor">编辑器</option>
                <option value="upload">附件上传</option>
                <option value="uploads">多附件上传</option>
            </select>
        </div>

        <div class="_hidden">
            <div class="form-group">
    	        <label>可选项</label>
    	        <textarea class="form-control" name="config" rows="4" placeholder="一行一个"></textarea>
            </div>
        </div>

        <div class="form-group">
            <label>字段说明</label>
            <input type="text" class="form-control" name="tips" value="">
        </div>

        <div class="form-group">
            <label>样式</label>
            <textarea class="form-control" name="style" rows="3" placeholder=""></textarea>
        </div>

        <div class="form-group">
            <label>排序</label>
            <input type="number" class="form-control" name="weight" value="50">
        </div>

        <div class="form-group">
            <label>后台列表展示</label>
            <select class="form-control" name="admin_show" required>
                <option value="0">不展示</option>
                <option value="1">展示</option>
            </select>
        </div>

        <input type="hidden" name="model_id" value="{$model_id}">
        <button type="submit" class="btn btn-primary">提交</button>
    </fieldset>
</form>
{include /common/footer}